package com.sy.aspect;

import com.sy.dto.JsonResult;
import com.sy.exception.BusinessException;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;
import java.util.Arrays;

@Component
@Aspect
//如果在同时有多个切面，则Order的值越小，切面越先执行
@Order(1)
public class PermissionAspect {
    @Pointcut("execution(* com.sy.controller.*.*(..))")
    public void method() {

    }

    @Before(value = "method()")
    public Object permissionCheck(JoinPoint joinPoint) {

       throw new BusinessException(HttpStatus.BAD_GATEWAY,"111111");
    }

}
